using System.Collections.Generic;
using System.IO;
using Templates.SharpParts;
using Templates.SharpParts.Shells;
using UsingNamespace = Templates.SharpParts.Helpers.UsingNamespace;

namespace Templates
{
	public class Class
	{
		private readonly List<string> _logs = new List<string>();
		private HashSet<string> _usingNamespaces = new HashSet<string>();
		private string FileName { get; set; }

		public ClassShell ClassShell { get; set; }

		private FileStream GetFileStream(string fileName = null)
		{
			if (fileName == null)
				fileName = FileName;

			return new FileStream(fileName, FileMode.Create);
		}

		public void CreateClass()
		{
			using (Stream sw = GetFileStream(FileName))
				CreateClass(sw);
		}

		public void CreateClass(Stream stream)
		{
			CreateNamespaces(stream);
			CreateClassShell(stream);
		}

		public void CreateClassShell(Stream stream)
		{
			//ClassShell.Write(stream, _logs);
		}

		public void CreateNamespaces(Stream stream)
		{
			if (_usingNamespaces.Count == 0) 
				return;

			UsingNamespace usingNamespace = new UsingNamespace();
			foreach (var ns in _usingNamespaces)
			{
				usingNamespace.NamespaceName = ns;
				//usingNamespace.Write(stream, _logs);
			}
		}
	}
}